@extends('master/master_index')

@section('css')
    <link rel="stylesheet" type="text/css" href="{{asset('home/css/Topic_UserCenter.css')}}">
@endsection

@section('title')
    <title>修改文章</title>
@endsection

@section('content')
    <div class="tp_form_div">
        <div class="tp_form_top"><i class="Hui-iconfont">&#xe647;</i>修改文章</div>
        <form action="{{url('topic_update')}}/topic={{$topic->id}}" method="post" class="t_post_form">
            <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
            <lable for="section">版 块:</lable>
            <select name="section" >
                @foreach($section as $s)
                <option @if($topic->section==$s->id) selected="selected" @endif value="{{$s['id']}}">{{$s['title']}}</option>
                @endforeach
            </select><br/>
            <lable for="title">标 题:</lable>
            <input type="text" class="topic_title" name="title" required="required" placeholder="标题不能为空" value="{{$topic->title}}"><br/>
            <lable for="tag">标 签:</lable>
            @foreach($tags as $t)
                <input class="tags_input" name="tags[]" type="checkbox" value="{{$t['id']}}" /> {{$t['tag_name']}}
            @endforeach
            <textarea id="content" name="content" class="form-control" rows="3">{{$topic->content}}</textarea>
            <button type="submit"><i class="Hui-iconfont">&#xe603;</i>修改</button>
        </form>
    </div>
@endsection
@section('js')
    <script type="text/javascript">
        window.onload = function()
        {
            CKEDITOR.replace( 'content', {
                filebrowserBrowseUrl: '{{url('upload/')}}',
                filebrowserUploadUrl: '{{url('topic_image')}}?_token={{csrf_token()}}'
            });
        };
    </script>
@endsection